﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace DecisionFramework.Text
{
    [TestClass]
    public class TextHelperTests
    {
        [TestMethod]
        public void TextHelper_UpToWithLessThan_Success()
        {
            // arrange
            string source = "1234567";
            
            // act
            string result = TextHelper.UpTo(source, 8);

            // assert
            Assert.IsTrue(result.Length <= 8);
            Assert.IsTrue(result.Length == 7);
        }

        [TestMethod]
        public void TextHelper_UpToWithEqualThan_Success()
        {
            // arrange
            string source = "12345678";

            // act
            string result = TextHelper.UpTo(source, 8);

            // assert
            Assert.IsTrue(result.Length <= 8);
            Assert.IsTrue(result.Length == 8);
        }

        [TestMethod]
        public void TextHelper_UpToWithGreaterThan_Success()
        {
            // arrange
            string source = "123456789";

            // act
            string result = TextHelper.UpTo(source, 8);

            // assert
            Assert.IsTrue(result.Length <= 8);
            Assert.IsTrue(result.Length == 8);
            Console.WriteLine(result);
        }
    }
}
